<!DOCTYPE html>
<html>

<head>
    <title>
        HTML DOM requestFullscreen() Method
    </title>

    <script>
        var elem = document.documentElement;

        function closeFullS() {
            if (document.exitFullscreen)
                document.exitFullscreen();
        }

        function openFullS() {
            if (elem.requestFullscreen)
                elem.requestFullscreen();
        }
    </script>
</head>

<body style="text-align:center;">

    <h1 style="color:green">
        GeeksforGeeks
    </h1>

    <h2>
        HTML DOM requestFullscreen() Method
    </h2>

    <button onclick="openFullS();">
        Open Fullscreen
    </button>

    <button onclick="closeFullS();">
        Close Fullscreen
    </button>
</body>

</html>